//AutoCriticalLock.h 

#pragma once

class CriticalLOCK
{
protected:
	CRITICAL_SECTION m_cs;
public:
	CriticalLOCK()
	{
		::InitializeCriticalSection(&m_cs);
	}
	~CriticalLOCK()
	{
		::DeleteCriticalSection(&m_cs);
	}
	void Lock()
	{
		::EnterCriticalSection(&m_cs);
	}
	void UnLock()
	{
		::LeaveCriticalSection(&m_cs);
	}
};